<template>
  <div class="page chat-express-inquiry">
    <div class="content">
      <div class="weui-cells weui-cells_after-title">
        <div class="weui-cell">
          <div class="weui-cell__hd">
            <div class="weui-label">快递单号</div>
          </div>
          <div class="weui-cell__bd">
            <input
              class="weui-input"
              type="number"
              placeholder="请输入快递单号"
              v-model="expressNumber"/>
          </div>
        </div>
      </div>
      <div class="weui-cells__tips">仅支持查询顺丰快递单号</div>
      <div class="weui-btn-area">
        <button
          class="weui-btn"
          type="primary"
          @click="onSearchBtnClick"
          :disabled="!expressNumber">查询</button>
      </div>
    </div>
  </div>
</template>
 
<script>
import mixins from '@/mixins'

export default {
  mixins: [mixins],
  data () {
    return {
      expressNumber: ''
    }
  },
  mounted () {
    this.resetData()
  },
  methods: {
    async onSearchBtnClick () {
      const result = await this.$store.dispatch('selectRouteTrackByNo', {
        sfNo: this.expressNumber
      })
      this.$store.state.expressInquiryResult = result
      wx.navigateTo({
        url: `/pages/express-inquiry-result/main`,
      })
    }
  }
}
</script>
 
<style lang="less">
.chat-express-inquiry {
  .content {
    padding: 30rpx 0;
  }
}
</style>
